package hdfs;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

public class put {
    public static void main(String[] args) {
        Configuration conf = new Configuration();
        FileSystem fs = null;
        try {
            fs = FileSystem.get(new URI("hdfs://hadoop2:9000"),conf);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
        try {
            fs.copyFromLocalFile(new Path("D:/Professional Study/综合实训/lagou.txt"),new
                    Path("/zyb/lagou"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        try {
            fs.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        System.out.println("close");
    }
}
